package com.dong.nacosclient_demo.controller;

import com.dong.nacosclient_demo.service.FeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.PostConstruct;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@RestController
@Slf4j
@RefreshScope
public class EchoController {

    @Autowired
    RestTemplate restTemplate;

    @Autowired
    FeignService feignService;

    @Value("${common.name}")
    private String name;


    @GetMapping(value = "/echo/{string}")
    public R echo(@PathVariable String string) {
//        String url = "http://mall-order/order/findOrderByUserId/"+666;
        //R result = restTemplate.getForObject(url,R.class);
        return R.ok(name);
    }
}
